package de.slothsoft.commons.swing;

import java.util.List;

public abstract class AbstractDatabaseModel<T> extends
		AbstractListTableModel<T> {

	private static final long serialVersionUID = 1L;

	public AbstractDatabaseModel(String[] columnNames) {
		super(columnNames);
		getList().addAll(reloadFromDatabase());
	}

	public void refresh() {
		getList().clear();
		getList().addAll(reloadFromDatabase());
		fireTableDataChanged();
	}

	protected abstract List<T> reloadFromDatabase();
}
